import http from '@/utils/axios'
export default {
  savePage(pram) {
    //保存编辑好的页面
    return http({
      url: `/management-fat-portal/preference/add`,
      method: 'post',
      data: pram,
    })
  },
  savePortletList(pram) {
    return http({
      url: `/management-fat-portal/portlet/add`,
      method: 'post',
      data: pram,
    })
  },
  saveLayoutList(pram) {
    return http({
      url: `/management-fat-portal/layout/add`,
      method: 'post',
      data: pram,
    })
  },
  getLayoutList(pram) {
    return http({
      url: `/management-fat-portal/layout/getList?pageNo=${pram.pageNo}&pageSize=${pram.pageSize}`,
      method: 'get',
    })
  },
  getPortletList(pram) {
    return http({
      url: `/management-fat-portal/portlet/getList?pageNo=${pram.pageNo}&pageSize=${pram.pageSize}`,
      method: 'get',
    })
  },
  searchLayoutList(pram) {
    let ul = ''
    if (pram.name && pram.description) {
      ul = `&name=${pram.name}&description=${pram.description}`
    } else if (pram.name) {
      ul = `&name=${pram.name}`
    } else if (pram.description) {
      ul = `&description=${pram.description}`
    }
    return http({
      url: `/management-fat-portal/layout/getList?pageNo=${pram.pageNo}&pageSize=${pram.pageSize}` + ul,
      method: 'get',
    })
  },
  searchportList(pram) {
    let ul = ''
    if (pram.name && pram.description) {
      ul = `&name=${pram.name}&description=${pram.description}`
    } else if (pram.name) {
      ul = `&name=${pram.name}`
    } else if (pram.description) {
      ul = `&description=${pram.description}`
    }
    return http({
      url: `/management-fat-portal/portlet/getList?pageNo=${pram.pageNo}&pageSize=${pram.pageSize}` + ul,
      method: 'get',
    })
  },
}
